package net.mcfire.aliyunplugin;

import com.alibaba.fastjson.JSONObject;

public class RoomInfo {

    public final int id;

    public final String title;

    public final String mode;
    public final String map;

    public RoomInfo(int id, String title, String mode, String map) {
        this.id = id;
        this.title = title;
        this.mode = mode;
        this.map = map;
    }

    @Override
    public String toString() {
        return String.format("Room[#%d, gm=%s, map=%s]", id, mode, map);
    }

    public static RoomInfo from(JSONObject j) {
        return new RoomInfo(j.getIntValue("id"), j.getString("title"), j.getString("gamemode"), j.getString("map"));
    }

}
